package janino.resource;

import janino.compilador.Resource;

public class LocalResourceFinder extends ResourceFinder {

    private final String path;

    public LocalResourceFinder(String path) {
        this.path = path;
       
    }

    public Resource findResource(String resourceName) {
        String competo = "/" + path + resourceName.substring(0, resourceName.indexOf('.'))+".clazz";
        if (getClass().getResourceAsStream(competo) != null) {
            return new LocalResource(competo);
        }
        return null;
    }
}
